<template>
	<fui-button @click="onPlay" size="mini" width="422rpx" height="64rpx">
		<fui-icon name="suspend" color="#fff" size="32rpx" style="margin-right: 8rpx;"></fui-icon>
		<slot>播放录音</slot>
	</fui-button>
</template>

<script>
	import BenzAMRRecorder from 'benz-amr-recorder'

	export default {

		props: {
			url: String
		},
		data() {
			return {

			}
		},
		methods: {

			onPlay() {
				if (this.url) {
					const amr = new BenzAMRRecorder();
					amr.initWithUrl(this.url).then(function() {
						amr.play();
					});
					amr.onEnded(function() {
						alert('播放完毕');
					})

				}
			}
		}
	}
</script>

<style>

</style>